package mvstore;

import java.util.Date;
import org.h2.mvstore.MVMap;
import org.h2.mvstore.MVStore;

public class MVStoreTest {

    public static void main(String[] args) {

        System.out.println(new Date(1568682313896L));
        // open the store (in-memory if fileName is null)
        MVStore s = MVStore.open("/Users/dingjianfeng/IdeaProjects/GitTest/src/main/java/mvstore/mvStore.file");

// create/get the map named "data"
        MVMap<Integer, String> map = s.openMap("data");

// add and read some data
        map.put(1, "Hello World");

        System.out.println(map.get(1));
        long oldVersion = s.getCurrentVersion();
        s.commit();
        map.put(1, "hello mvstore");

        System.out.println("==========oldMap=============");
        MVMap<Integer, String> oldMap = map.openVersion(oldVersion);
        System.out.println(oldMap.get(1));
        System.out.println("==========newMap=============");
        System.out.println(map.get(1));

// close the store (this will persist changes)
        s.close();
    }
}
